package com.rules.admin.expression;

import com.google.common.collect.Lists;

import java.io.Serializable;
import java.util.Iterator;
import java.util.List;

public class RuleAssemblyExpression implements Expression, Serializable {
   private java.lang.Package packageName;
   private List<Import> imports = Lists.newArrayList();
   private List<RuleExpression> ruleExpressions = Lists.newArrayList();

   public RuleAssemblyExpression(java.lang.Package packageName) {
      this.packageName = packageName;
   }

   public void addImport(Import importPackage) {
      this.imports.add(importPackage);
   }

   public void addRule(RuleExpression ruleExpression) {
      this.ruleExpressions.add(ruleExpression);
   }

   public java.lang.Package getPackageName() {
      return this.packageName;
   }

   public List<Import> getImports() {
      return this.imports;
   }

   public List<RuleExpression> getRuleExpressions() {
      return this.ruleExpressions;
   }

   public void accept(ExpressionVisitor visitor) {
      visitor.vistor(this);
   }

   public String toString() {
      StringBuilder builder = new StringBuilder();
      builder.append(this.packageName).append("\n");
      Iterator var2 = this.imports.iterator();

      while(var2.hasNext()) {
         Import importPackage = (Import)var2.next();
         builder.append(importPackage + "\n");
      }

      var2 = this.ruleExpressions.iterator();

      while(var2.hasNext()) {
         RuleExpression ruleExpression = (RuleExpression)var2.next();
         builder.append(ruleExpression).append("\n\n");
      }

      return builder.toString();
   }
}
